<?php
/*
	插件概览
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$plugin_name = $_RQ['basicname'] ? $_RQ['basicname'] : '';
if($_RQ['op']=='get'){
	//显示统计数据
		$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
		$mounthtime =  mktime(0,0,0,date('m'),1,date('Y'));
		$access=array();
		$access['wechat_day']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>2,'createtime >'=>$daytime));
		$access['wxapp_day']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>1,'createtime >'=>$daytime));
		$access['mobile_day']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>3,'createtime >'=>$daytime));
		$access['pc_day']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>4,'createtime >'=>$daytime));
		$access['app_day']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>5,'createtime >'=>$daytime));
		$access['all_day']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'createtime >'=>$daytime));
		$access['wechat_all']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>2));
		$access['wxapp_all']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>1));
		$access['mobile_all']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>3));
		$access['pc_all']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>4));
		$access['app_all']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>5));
		$access['all_all']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin']));
		$wechat=array();
		//当日关注
		$wechat['focus_day']=pdo_count('core_fans',array('uniacid'=>$_SESSION['uniacid'],'type'=>2,'plugin'=>$_RQ['plugin'],'follow'=>1,'updatetime >'=>$daytime));
		//总关注
		$wechat['focus_all']=pdo_count('core_fans',array('uniacid'=>$_SESSION['uniacid'],'type'=>2,'plugin'=>$_RQ['plugin'],'follow'=>1));
		//当日取消关注
		$wechat['unfocus_day']=pdo_count('core_fans',array('uniacid'=>$_SESSION['uniacid'],'type'=>2,'plugin'=>$_RQ['plugin'],'follow'=>0,'updatetime >'=>$daytime));
		//总取消关注
		$wechat['unfocus_all']=pdo_count('core_fans',array('uniacid'=>$_SESSION['uniacid'],'type'=>2,'plugin'=>$_RQ['plugin'],'follow'=>0));
		//当日新增粉丝
		$wechat['fans_day']=pdo_count('core_fans',array('uniacid'=>$_SESSION['uniacid'],'type'=>2,'plugin'=>$_RQ['plugin'],'createtime >'=>$daytime));
		//总粉丝
		$wechat['fans_all']=pdo_count('core_fans',array('uniacid'=>$_SESSION['uniacid'],'type'=>2));
		//当日贡献会员
		$wechat['member_day']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'from_os'=>2,'plugin'=>$_RQ['plugin'],'createtime >'=>$daytime));
		//总贡献会员
		$wechat['member_all']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'from_os'=>2,'plugin'=>$_RQ['plugin']));
		$wxapp=array();
		$wxapp['access_day']=$access['wxapp_day'];
		$wxapp['access_mounth']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>1,'createtime >'=>$mounthtime));
		$wxapp['access_all']=$access['wxapp_all'];
		//当日新增粉丝
		$wxapp['fans_day']=pdo_count('core_fans',array('uniacid'=>$_SESSION['uniacid'],'type'=>1,'plugin'=>$_RQ['plugin'],'createtime >'=>$daytime));
		//总粉丝
		$wxapp['fans_all']=pdo_count('core_fans',array('uniacid'=>$_SESSION['uniacid'],'type'=>1));
		//当日贡献会员
		$wxapp['member_day']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'from_os'=>1,'plugin'=>$_RQ['plugin'],'createtime >'=>$daytime));
		//总贡献会员
		$wxapp['member_all']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'from_os'=>1,'plugin'=>$_RQ['plugin']));
		//手机端数据
		$mobile=array();
		//当月访问
		$mobile['access_mounth']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>3,'createtime >'=>$mounthtime));
		//总访问
		$mobile['access_all']=$access['mobile_all'];
		//当日贡献会员
		$mobile['member_day']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'from_os'=>3,'plugin'=>$_RQ['plugin'],'createtime >'=>$daytime));
		//总贡献会员
		$mobile['member_all']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'from_os'=>3,'plugin'=>$_RQ['plugin']));
		//app端数据
		$app=array();
		//当月访问
		$app['access_mounth']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'plugin'=>$_RQ['plugin'],'os'=>5,'createtime >'=>$mounthtime));
		//总访问
		$app['access_all']=$access['app_all'];
		//当日贡献会员
		$app['member_day']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'from_os'=>5,'plugin'=>$_RQ['plugin'],'createtime >'=>$daytime));
		//总贡献会员
		$app['member_all']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'from_os'=>5,'plugin'=>$_RQ['plugin']));
		//pc端数据
		$pc=array();
		//当月访问
		$pc['access_mounth']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'os'=>4,'plugin'=>$_RQ['plugin'],'createtime >'=>$mounthtime));
		//总访问
		$pc['access_all']=$access['pc_all'];
		//当日贡献会员
		$pc['member_day']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'from_os'=>4,'plugin'=>$_RQ['plugin'],'createtime >'=>$daytime));
		//总贡献会员
		$pc['member_all']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'from_os'=>4));
		$return['htmls']=array(
				array('type'=>'data','one_num'=>2,'title'=>'应用今日/总访问数据指标','datas'=>array(
					array('title'=>'公众号数据','num'=>2,'data'=>array($access['wechat_day'],$access['wechat_all'])),
					array('title'=>'小程序数据','num'=>2,'data'=>array($access['wxapp_day'],$access['wxapp_all'])),
					array('title'=>'手机端数据','num'=>2,'data'=>array($access['mobile_day'],$access['mobile_all'])),
					array('title'=>'PC端数据','num'=>2,'data'=>array($access['pc_day'],$access['pc_all'])),
					array('title'=>'APP端数据','num'=>2,'data'=>array($access['app_day'],$access['app_all'])),
					array('title'=>'总访问量','num'=>2,'data'=>array($access['all_day'],$access['all_all'])),
				)),
				array('type'=>'echarts_pie','one_num'=>2,'width'=>'50%','ecid'=>'wechat','title'=>'公众号数据指标','datas'=>array(
					'time' => date("Y-m-d H:i:s", time()),
					'datas'=>array(
						array('name'=>'总关注','value'=>$wechat['focus_all']),
						array('name'=>'小程序数据','value'=>$wechat['unfocus_all']),
						array('name'=>'手机端数据','value'=>$wechat['fans_all']),
						array('name'=>'PC端数据','value'=>$wechat['member_all']),
					),
				)),
				array('type'=>'echarts_pie','one_num'=>2,'width'=>'50%','ecid'=>'wxapp','title'=>'小程序数据指标','datas'=>array(
					'time' => date("Y-m-d H:i:s", time()),
					'datas'=>array(
						array('name'=>'总访问量','value'=>$wxapp['access_all']),
						array('name'=>'当月访问量','value'=>$wxapp['access_mounth']),
						array('name'=>'总粉丝数','value'=>$wxapp['fans_all']),
						array('name'=>'PC端数据','value'=>$wxapp['member_all']),
					),
				)),
	);
	exi($return);
}